Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Change Electric Kiwi authentication #135231

Merged
merged 42 commits into from
Feb 5, 2025
Merged

Conversation

mikey0000
Copy link
Contributor

@mikey0000 mikey0000 commented Jan 9, 2025

Migrate from a unique id of DOMAIN to customer number

Breaking change

Proposed change

Fix unique id and migrate, fix small issue where title would be Home Assistant Cloud, now is the customer id
Library bump was also required due to API migration
mikey0000/EK-API@0.8.5...0.9.12

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@mikey0000 mikey0000 marked this pull request as draft January 9, 2025 19:58
homeassistant/components/electric_kiwi/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/electric_kiwi/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/electric_kiwi/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/electric_kiwi/quality_scale.yaml Outdated Show resolved Hide resolved
@mikey0000 mikey0000 requested a review from joostlek January 9, 2025 22:07
@mikey0000 mikey0000 marked this pull request as ready for review January 9, 2025 22:08
@mikey0000 mikey0000 requested a review from joostlek January 9, 2025 22:29
homeassistant/components/electric_kiwi/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/electric_kiwi/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/electric_kiwi/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/electric_kiwi/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/electric_kiwi/config_flow.py Outdated Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft January 10, 2025 11:34
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@joostlek
Copy link
Member

But I am missing, why do we do this? What was the unique id before and what will it be now?

@mikey0000
Copy link
Contributor Author

mikey0000 commented Jan 10, 2025

But I am missing, why do we do this? What was the unique id before and what will it be now?

Unique id was "electric_kiwi" and now it will be their customer number.

Copy link
Member

@joostlek joostlek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Electricity object is not being patched

@home-assistant home-assistant bot marked this pull request as draft February 3, 2025 14:42
@joostlek joostlek added this to the 2025.2.0 milestone Feb 3, 2025
@joostlek joostlek added the bugfix label Feb 3, 2025
@mikey0000
Copy link
Contributor Author

mikey0000 commented Feb 3, 2025

So migrating users is doing my head in.... the api changes are messy as the token is ring fenced to the old scopes if users are authenticated. The identifier is not the same as well I'll need to make an extra API call to get the same id I used in the past/ migrate entities as well.

I need to get users to re-authenticate before migrating.

EDIT: resolved now. Got it sorted, added new tests

@mikey0000 mikey0000 marked this pull request as ready for review February 3, 2025 21:51
@home-assistant home-assistant bot requested a review from joostlek February 3, 2025 21:51
Copy link
Member

@joostlek joostlek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to find the source of the library

@home-assistant home-assistant bot marked this pull request as draft February 5, 2025 12:03
@joostlek joostlek changed the title Bugfix: Electric Kiwi migrate unique id Change Electric Kiwi authentication Feb 5, 2025
@mikey0000 mikey0000 marked this pull request as ready for review February 5, 2025 18:47
@home-assistant home-assistant bot requested a review from joostlek February 5, 2025 18:47
@joostlek joostlek modified the milestones: 2025.2.0, 2025.2.1 Feb 5, 2025
@joostlek joostlek merged commit 94614e0 into home-assistant:dev Feb 5, 2025
46 checks passed
@mikey0000 mikey0000 deleted the ek-fixes branch February 5, 2025 19:02
@cdce8p
Copy link
Member

cdce8p commented Feb 6, 2025

Hey @mikey0000 👋🏻 Your library pins python <3.13. This causes issues with our wheel builder. I opened mikey0000/EK-API#1 with some packaging updates. Would be great if you could take a look at it as soon as possible and release a new version afterwards + open a PR here. Thanks a lot!

https://github.com/home-assistant/core/actions/runs/13171579271/job/36762816394#step:9:766

@github-actions github-actions bot locked and limited conversation to collaborators Feb 7, 2025
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants